(1) Field of the Invention
The present invention relates to a moving picture coding device, a moving picture coding method, and a moving picture coding program in which a coded data buffer is used.
(2) Description of the Related Art
In recent years, the MPEG format or H.264 format has been known as a moving picture coding format used in accumulating or transmitting of a digital video, and compatibility between decoding devices has been ensured by defining operations of a coded data buffer (e.g., a Video Buffer Verifier (VBV) buffer according to the MPEG-2 standard, and a Coded Picture Buffer (CPB) according to the H.264 standard) in a decoding device.
Such a moving picture coding format is required to generate a bit stream based on the definition so that the coded data buffer of the decoding device does not fail.
Examples of the failure of the coded data buffer include underflow (buffer underflow) and overflow (buffer overflow). The buffer underflow means that an amount of a coded picture becomes excessive, and that a buffer occupancy amount of the coded data buffer of the decoding device becomes zero. The buffer overflow means that the amount of the coded picture becomes insufficient, and that the buffer occupancy amount exceeds the maximum amount of the coded data buffer.
A conventional coding device includes a buffer model (virtual buffer model) which simulates an occupancy amount of a coded data buffer of a decoding device so that the above failure of the coded data buffer is not caused. The conventional coding device assures conformity of the coded data buffer by controlling an amount of a coded picture through reflection of a result of the buffer model in a bit rate control.
This type of the conventional moving picture coding device is described with reference to FIG. 5. FIG. 5 is a block diagram showing a structure of the conventional moving picture coding device according to the MPEG-2 standard.
As shown in FIG. 5, the conventional moving picture coding device 100 includes a DCT unit 101, a quantization unit 102, a coding unit 103, a VBV modeling unit 104, and a bit rate control unit 105.
The DCT unit 101 performs an orthogonal transformation on an input image 111, and outputs a DCT coefficient 112. The quantization unit 102 quantizes the DCT coefficient 112 based on a quantization scale 117 obtained from the bit rate control unit 105, and outputs a quantization coefficient 113. The coding unit 103 performs source coding on the quantization coefficient 113 and additional information such as the quantization scale 117, and outputs a bit stream 114.
The VBV modeling unit 104 simulates a VBV buffer, which is a coded data buffer according to the MPEG-2 format, based on an amount of coded data 115, which is generated by the coding unit 103, and outputs a buffer occupancy amount (VBV buffer occupancy amount 116) to the bit rate control unit 105.
The MPEG-2 standard does not define a method of controlling an amount of coded data for the bit stream 114. In order to regulate a bit stream to have a desired amount of coded data, the bit rate control unit 105 generally determines the quantization scale 117 based on the amount of coded data and the buffer occupancy amount (VBV buffer occupancy amount 116) so that the coded data buffer does not fail.
Further, Patent Reference 1 (Japanese Unexamined Patent Application Publication No. 2006-295535) discloses a technique for coding for stable picture quality while limiting underflow of a VBV buffer. In the moving picture coding device disclosed in Patent Reference 1, the bit rate control unit 105 calculates a first quantization scale for minimizing an error between an amount of coded data generated so far and a target bit rate, and a second quantization scale for avoiding the underflow. The second quantization scale is determined so that an amount of coded data falls below an amount of coded data available until after the next reference picture is coded. The bit rate control unit 105 selects, as the quantization scale 117, larger one of the first and second quantization scales, and outputs the quantization scale 117 to the quantization unit 102.
As stated above, the conventional moving picture coding device operates so as not to cause the buffer underflow or the buffer overflow.
In order to avoid the buffer underflow, it is necessary to limit the amount of the data coded by the coding unit so that the amount of the coded data does not exceed the buffer occupancy amount. More specifically, examples of the method for avoiding the buffer underflow include a method for reducing a quantization coefficient by increasing a quantization scale based on a buffer occupancy amount, and a method for skipping coding with a DCT coefficient to skip a quantization coefficient.
However, the conventional moving picture coding device determines the quantization scale right before the coded data buffer fails so that the coded data buffer does not fail, and thus there is a problem that picture quality deteriorates. Moreover, reducing or skipping the quantization coefficient causes the above problem.
The moving picture coding device disclosed in Patent Reference 1 reduces the amount of the coded data using larger one of the two quantization scales, and avoids the buffer underflow. However, with the structure of Patent Reference 1, there is a problem that a discontinuous change of quality between pictures impairs subjective picture quality before and after the selection of the larger one of the quantization scales is switched. In particular, with the structure of Patent Reference 1, the first and second quantization scales are determined independently of each other, and thus there is a case where a control amount for increasing the amount of the coded data by the first quantization scale coexists with a control amount for decreasing the amount of the coded data by the second quantization scale. A conflict between the control amounts tends to cause a discontinuous picture quality difference between the pictures.
Furthermore, in Patent Reference 1, even in the case of an input image which causes gradual decrease of the coded data buffer, the first quantization scale is selected, because the buffer underflow is not initially caused. When the above situation continues and the buffer occupancy amount falls below the above available amount of the coded data, the second quantization scale significantly increases in an attempt to avoid the buffer underflow. Consequently, there is also a problem that a sudden change of a quantization scale by selecting the second quantization scale as the maximum value causes the discontinuous picture quality difference.
As stated above, although the conventional moving picture coding device attempts to avoid the buffer underflow by changing the quantization scale according to the buffer occupancy amount, there is the problem that the change of the discontinuous picture quality deteriorates the subjective picture quality.
It is to be noted that although there is a method for increasing an amount of a coded picture by decreasing a quantization scale, adding invalid data by a coding unit, and so on, in order to avoid the buffer overflow, the decrease in the quantization scale enhances the picture quality, and the invalid data does not contribute to enhance the picture quality, because the invalid data is coded data irrelevant to a picture signal. Further, in general variable bit rate (VBR) coding, a bit rate at which a bit stream is provided to a coded data buffer can be reduced or the provision of the bit stream can be suspended, and thus it is possible to avoid the overflow without adding the invalid data. As stated above, the operation for avoiding the buffer overflow does not cause the picture quality to deteriorate.